package Interface;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: wangxin
 * Date: 2024-09-14
 * Time: 10:41
 */
public class Student implements Comparable<Student>{
    public String name;
    public int age;

    public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }
  //用年龄进行比较
      @Override
      public int compareTo(Student o) {
        return this.age - o.age;
    }
//   用姓名进行比较
//    @Override
//    public int compareTo(Student o) {
//        return this.name.compareTo(o.name);
//    }
}
